package com.weayer.controller;

import com.weayer.dto.ResponseResult;
import com.weayer.response.TokenResponse;
import com.weayer.service.TokenService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description:  Api服务 - 乘客 -双token controller
 * @author: Weayer
 **/
@RestController
public class TokenController {
    @Autowired
    private TokenService tokenService;
    @PostMapping("/token-refresh")
    public ResponseResult refreshToken(@RequestBody TokenResponse tokenResponse){
        String refreshTokenStr = tokenResponse.getRefreshToken();
        return tokenService.refreshToken(refreshTokenStr);
    }
}
